CREATE PROCEDURE sp_ThemLoaiTinhTrang
	@TenTT nvarchar(30)
AS
BEGIN TRAN
	declare @Ma int
	set @Ma = 1

	while exists (SELECT * FROM LOAITINHTRANG WHERE MaTinhTrang = @Ma)
		set @Ma = @Ma + 1
	INSERT INTO LOAITINHTRANG VALUES(@Ma, @TenTT)
	if(@@error <> 0)
	begin
		raiserror('Loi khi them loai phong',16,1)
	end
COMMIT